/**
 * 文件：SystemManager.java
 * 包名：com.ronri.common;   --- 正式发布时需要修正
 * 说明：系统管理类公共函数
 * 作者：MS During
 * 日期：2017/5/2
 * 历史：
 */
package com.ronri.common;


import com.cz.nongyetongv5.application.InitApplication;

import java.lang.reflect.Field;


public class SystemManager {

    /****
     * 获取屏幕的状态栏高度
     * @return
     */
    public static int getStatusBarHeight() {
        Class<?> c = null;

        Object obj = null;

        Field field = null;

        int x = 0, sbar = 0;

        try {

            c = Class.forName("com.android.internal.R$dimen");

            obj = c.newInstance();

            field = c.getField("status_bar_height");

            x = Integer.parseInt(field.get(obj).toString());

            sbar = InitApplication.getInstance().getResources().getDimensionPixelSize(x);

        } catch (Exception e1) {
            e1.printStackTrace();
        }

        return sbar;
    }
}
